/*
 * DataConnection.java
 * 
 * Created by demory on Jul 11, 2009, 3:59:54 PM
 * 
 * Copyright 2008 David D. Emory
 * 
 * This file is part of Five Points. See <http://www.fpdev.org> for
 * additional information regarding the project.
 * 
 * Five Points is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Five Points is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Five Points.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.fpdev.core.data;

import java.util.Collection;
import org.fpdev.core.basenet.BLink;
import org.fpdev.core.basenet.BNode;

/**
 *
 * @author demory
 */
public interface SpatialDataConnection {

  public enum NodeAttr {
    SHAPE, FPID, SCEN
  }

  public enum LinkAttr {
    SHAPE, FPID, SCEN, NAME, TYPE, FNODE, TNODE, LEN, UPFW, UPBW, ELEVARR, TORARR, FADDRL, TADDRL, FADDRR, TADDRR, ZIPR, ZIPL
  }


  // QUERY NODE METHODS

  public Collection<BNode> allNodes();

  public BNode nodeFromID(int id);
  
  public Collection<BNode> nearbyNodes(double x, double y, double r);

  public Collection<BNode> nodesInRange(double x1, double y1, double x2, double y2);

  public Collection<BNode> nodesInSet(Collection<Integer> ids);

  // QUERY NODE METHODS

  public Collection<BLink> allLinks();

  public Collection<BLink> linksInRange(double x1, double y1, double x2, double y2);

  public Collection<BLink> linksInSet(Collection<Integer> ids);

  // MODIFICATION METHODS

  public void createNode(BNode node);

  public void deleteNode(BNode node);

  public void createLink(BLink link);

  public void deleteLink(BLink link);

  public void modifyNode(BNode node, NodeAttr[] attrs);

  public void modifyNodes(Collection<BNode> nodes, NodeAttr[] attrs);

  public void modifyLink(BLink link, LinkAttr[] attrs);

  public void modifyLinks(Collection<BLink> links, LinkAttr[] attrs);


  // MISC METHODS

  public void close();

}
